package gui;
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ReportPanel extends javax.swing.JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextField title;
	private JTable report;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new ReportPanel());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	public ReportPanel() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			FormLayout thisLayout = new FormLayout(
					"50dlu, 70dlu, 70dlu, 55dlu", 
					"15dlu, 24dlu, 54dlu, 150dlu");
			this.setLayout(thisLayout);
			this.setPreferredSize(new java.awt.Dimension(365, 380));
			this.setSize(365, 380);
			{
				title = new JTextField();
				this.add(title, new CellConstraints("2, 1, 2, 1, default, default"));
				title.setText("\tRAPORT");
				title.setEditable(false);
			}
			{
				TableModel jTable1Model = new DefaultTableModel(new String[][] {
						{ "One", "Two" }, { "Three", "Four" } }, new String[] {
						"Column 1", "Column 2" });
				report = new JTable();
				this.add(report, new CellConstraints("1, 3, 4, 2, default, default"));
				report.setModel(jTable1Model);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public void setReportModel(TableModel tableModel) {
		if (tableModel != null)
			report.setModel(tableModel);
	}

}
